package com.shell.customer.util;

import com.shell.bee.base.utils.SpringContextUtil;
import com.shell.bee.base.utils.StringUtil;

public class CustomerUtil {
	private static String PAID_MODE_KEY = "paid.mode";
	private static Boolean ONLINE_PAY;
	private static String CHAIN_SWITCH_KEY = "chain.switch";
	private static String ESIGN_SWITCH_KEY = "esign.switch";
	private static Boolean CHAIN_SWITCH_ON;
	private static Boolean ESIGN_SWITCH_ON;
	private static String CFCA_SWITCH_KEY = "cfca.switch";
	private static Boolean CFCA_SWITCH_ON;

	public static boolean onlinePay() {
		if (ONLINE_PAY == null) {
			ONLINE_PAY = Boolean.valueOf(false);
			String paidMode = SpringContextUtil.getProperty(PAID_MODE_KEY);
			if ((StringUtil.notEmpty(paidMode)) && ("online".equals(paidMode))) {
				ONLINE_PAY = Boolean.valueOf(true);
			}
		}
		return ONLINE_PAY.booleanValue();
	}

	public static boolean onChain() {
		if (CHAIN_SWITCH_ON == null) {
			CHAIN_SWITCH_ON = Boolean.valueOf(false);
			String chainSwitch = SpringContextUtil.getProperty(CHAIN_SWITCH_KEY);
			if ((StringUtil.notEmpty(chainSwitch)) && ("on".equals(chainSwitch))) {
				CHAIN_SWITCH_ON = Boolean.valueOf(true);
			}
		}
		return CHAIN_SWITCH_ON.booleanValue();
	}

	public static boolean onEsign() {
		if (ESIGN_SWITCH_ON == null) {
			ESIGN_SWITCH_ON = Boolean.valueOf(false);
			String esignSwitch = SpringContextUtil.getProperty(ESIGN_SWITCH_KEY);
			if ((StringUtil.notEmpty(esignSwitch)) && ("on".equals(esignSwitch))) {
				ESIGN_SWITCH_ON = Boolean.valueOf(true);
			}
		}
		return ESIGN_SWITCH_ON.booleanValue();
	}

	public static boolean onCfca() {
		if (CFCA_SWITCH_ON == null) {
			CFCA_SWITCH_ON = Boolean.valueOf(false);
			String esignSwitch = SpringContextUtil.getProperty(CFCA_SWITCH_KEY);
			if ((StringUtil.notEmpty(esignSwitch)) && ("on".equals(esignSwitch))) {
				CFCA_SWITCH_ON = Boolean.valueOf(true);
			}
		}
		return CFCA_SWITCH_ON.booleanValue();
	}
}
